﻿using NP.BPMReportPlatform.Common.Dtos;
using NP.BPMReportPlatform.CourseTrain.Dtos;
using NP.BPMReportPlatform.Entities.BPM_Business;
using NP.BPMReportPlatform.UserTrial.Dto;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using static NP.BPMReportPlatform.CourseTrain.Dtos.CourseReportDto;

namespace NP.BPMReportPlatform.CourseTrain
{
    /// <summary>
    /// 工程接口服务
    /// </summary>
    public interface ICourseTrainTaskService : IApplicationService
    {
        /// <summary>
        /// 获取任务单详情信息
        /// </summary>
        /// <param name="courseTrainTaskId">任务单号</param>
        /// <returns>任务单详情</returns>
        Task<CourseTrainTaskDto> GetCourseTrainTaskData(string courseTrainTaskId);

        /// <summary>
        /// 获取ILearning选项
        /// </summary>
        /// <returns>任务单详情</returns>
        Task<List<ItemPairDto>> GetILearningOptions();

        /// <summary>
        /// 培训任务单列表明细查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>培训任务单列表</returns>
        Task<PagedResultPowerDto<GetTrainTaskOutput>> GetTrainTaskListResult(GetTrainResultInput input);

        /// <summary>
        /// 同步iLearning课程信息
        /// </summary>
        /// <returns>是否成功</returns>
        Task<string> SyncTrainCourses(int times = 0);

        /// <summary>
        /// 新增或者更新培训讲师数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task AddOrUpdateCourseInstructor(CourseInstructorEntity input);

        /// <summary>
        /// 讲师列表明细查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>讲师列表明细查询数据</returns>
        Task<PagedResultPowerDto<GetCourseInstructorOutput>> GetCourseInstructorList(GetCourseItemInput input);

        /// <summary>
        /// 更新培训讲师状态
        /// </summary>
        /// <param name="courseInstructorId">主键</param>
        /// <param name="status">状态</param>
        Task UpdateCourseInstructorStatus(string courseInstructorId, int status);


        /// <summary>
        /// 删除培训讲师数据
        /// </summary>
        /// <param name="courseInstructorId">主键</param>
        Task DeleteCourseInstructor(string courseInstructorId);

        /// <summary>
        /// 培训讲师数据 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<List<GetCourseInstructorOutput>> ExportCourseInstructorResultAsync(GetCourseItemInput input);

        /// <summary>
        /// 根据iLearaning获取培训人员明细数据
        /// </summary>
        /// <param name="ilearningCodes">请求参数</param>
        /// <returns>培训人员明细列表</returns>
        Task<List<CourseTrainUserDetailEntity>> GetTrainUsers(List<string> ilearningCodes);

        /// <summary>
        /// 根据工号获取培训人员明细数据
        /// </summary>
        /// <param name="worknumbers">请求参数</param>
        /// <returns>培训人员明细数据</returns>
        Task<List<CourseTrainUserDetailEntity>> GetUserInfo(List<string> worknumbers);

        /// <summary>
        /// 提交任务单数据
        /// </summary>
        /// <param name="data">请求参数</param>
        /// <param name="isSubmit">是否提交</param>
        /// <returns>返回消息</returns>
        Task<(bool Result, string Msg)> CourseTrainTaskSave(CourseTrainTaskDto data, bool isSubmit);

        /// <summary>
        /// 获取培训考证列表数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>培训考证列表数据</returns>
        Task<PagedResultPowerDto<GetCourseCertOutput>> GetCourseCertListResult(GetTrainResultInput input);

        /// <summary>
        /// 上传证书文件
        /// </summary>
        /// <param name="fs">fs</param>
        /// <param name="fileName">文件名称</param>
        /// <param name="courseTrainUserDetailId">明细id</param>
        /// <returns></returns>

        Task<(bool Result, string Msg)> UploadCert(byte[] fs, string fileName, string courseTrainUserDetailId);

        /// <summary>
        /// 更新证书截止日期
        /// </summary>
        /// <param name="endDate">截止日期</param>
        /// <param name="courseTrainUserDetailId">明细id</param>
        Task CertEndDate(string courseTrainUserDetailId, DateTime endDate);

        /// <summary>
        /// 报销获取培训人员信息接口
        /// </summary>
        /// <returns></returns>
        Task<TrainingMasterDataDto.ResponseDto> GetReimbursementTrainUser(TrainingMasterDataDto.RequestDto request);

        /// <summary>
        /// RISK获取培训人员信息接口
        /// </summary>
        /// <returns></returns>
        TrainTaskInfoDto GetTrainTaskInfo(string id);

        /// <summary>
        /// 海外培训任务单列表明细查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>培训任务单列表</returns>
        Task<PagedResultPowerDto<GetTrainOverSeaOutput>> GetTrainOverSeaListResult(GetTrainResultInput input);

        /// <summary>
        /// 获取海外任务单详情信息
        /// </summary>
        /// <param name="courseId">任务单号</param>
        /// <returns>任务单详情</returns>
        Task<CourseOverSeaDto> GetCourseOverSeaData(string courseId);

        /// <summary>
        /// 获取讲师下拉选项
        /// </summary>
        Task<List<ItemPairDto>> GetInstructorOptions();

        /// <summary>
        /// 提交培训心得，总结
        /// </summary>
        /// <param name="summaryDto">任务单号</param>
        /// <returns></returns>
        Task<(bool Result, string Msg)> SummarySubmit(CourseSummaryEntity summaryDto);

        /// <summary>
        /// 变更任务单状态
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="status">status</param>
        /// <returns>返回消息</returns>
        public Task UpdateStatus(string id, int status);

        /// <summary>
        /// 国内培训计划流程表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PagedResultPowerDto<ExportCourseOutput>> GetReportResult(CourseReportDto.ReportSearchDto input);

        /// <summary>
        /// 国内培训计划流程表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PagedResultPowerDto<CourseTrainTaskReportDto>> GetExpenseReportResult(CourseReportDto.ReportSearchDto input);

        /// <summary>
        /// 变更海外任务单状态
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="status">status</param>
        /// <returns>返回消息</returns>
        Task<(bool Result, string Msg)> UpdateOverSeaStatus(string id, int status);

        /// <summary>
        /// 新增或者更新培训项目数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task AddOrUpdateCourseProject(CourseProjectEntity input);

        /// <summary>
        /// 讲师列表明细查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>讲师列表明细查询数据</returns>
        Task<PagedResultPowerDto<GetCourseProjectOutput>> GetCourseProjectList(GetCourseItemInput input);

        /// <summary>
        /// 更新培训项目状态
        /// </summary>
        /// <param name="courseProjectId">主键</param>
        /// <param name="status">状态</param>
        Task UpdateCourseProjectStatus(string courseProjectId, int status);


        /// <summary>
        /// 删除培训项目数据
        /// </summary>
        /// <param name="courseProjectId">主键</param>
        Task DeleteCourseProject(string courseProjectId);

        /// <summary>
        /// 培训项目数据 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<List<GetCourseProjectOutput>> ExportCourseProjectResultAsync(GetCourseItemInput input);

        /// <summary>
        /// 获取项目下拉选项
        /// </summary>
        Task<List<ItemPairDto>> GetProjectOptions();

        /// <summary>
        /// 新增或者更新培训课程数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task AddOrUpdateCourseManage(CourseManageEntity input);

        /// <summary>
        /// 讲师列表明细查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>讲师列表明细查询数据</returns>
        Task<PagedResultPowerDto<GetCourseManageOutput>> GetCourseManageList(GetCourseItemInput input);

        /// <summary>
        /// 更新培训课程状态
        /// </summary>
        /// <param name="courseManageId">主键</param>
        /// <param name="status">状态</param>
        Task UpdateCourseManageStatus(string courseManageId, int status);


        /// <summary>
        /// 删除培训课程数据
        /// </summary>
        /// <param name="courseManageId">主键</param>
        Task DeleteCourseManage(string courseManageId);

        /// <summary>
        /// 培训课程数据 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<List<GetCourseManageOutput>> ExportCourseManageResultAsync(GetCourseItemInput input);

        /// <summary>
        /// 获取课程下拉选项
        /// </summary>
        Task<List<ItemPairDto>> GetManageOptions();

        /// <summary>
        /// 同步iLearning讲师数据
        /// </summary>
        Task SyncInstractor();

        /// <summary>
        /// 讲师项目使用情况明细查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>讲师项目使用情况明细查询数据</returns>
        Task<PagedResultPowerDto<GetInstructorUseSummaryOutput>> GetCourseInstructorUseList(GetTrainResultInput input);

        /// <summary>
        /// 培训讲师使用明细数据 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<List<GetInstructorUseSummaryOutput>> ExportCourseInstructorUseListAsync(GetTrainResultInput input);

        /// <summary>
        /// 查询境外来华清单数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns>境外来华明细查询数据</returns>
        Task<PagedResultPowerDto<GetCourseAbToChinaOutput>> GetCourseAbToChinaList(GetCourseAbToChinaInput input);

        /// <summary>
        /// 海外来华任务单 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<List<GetCourseAbToChinaOutput>> ExportCourseAbToChinaListAsync(GetCourseAbToChinaInput input);

        /// <summary>
        /// 新增或者更新境外来华清单数据
        /// </summary>
        /// <param name="input"></param>
        Task AddOrUpdateCourseAbroadToChina(CourseAbroadToChinaEntity input);

        /// <summary>
        /// 删除境外来华清单数据
        /// </summary>
        /// <param name="abroadId">主键</param>
        Task DeleteAbroadToChina(string abroadId);

        /// <summary>
        /// 更新护照信息
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="value">号码</param>
        /// <returns>返回消息</returns>
        Task<(bool Result, string Msg)> UpdatePortNumber(string id, string value);

        /// <summary>
        /// 导入海外来华任务数据
        /// </summary>
        /// <param data="导入数据"></param>
        /// <returns></returns>
        Task ImportAbroadUsersAsync(List<CourseAbroadToChinaEntity> data);

        /// <summary>
        /// 更新证书状态
        /// </summary>
        /// <param name="status">状态</param>
        /// <param name="courseTrainUserDetailId">明细id</param>
        /// <returns></returns>
        Task CertUpdateStatus(string courseTrainUserDetailId, int status);
    }
}